﻿using Shape;
using Shape.Mvp.Sample.Conversations.Domain.Model;
using Shape.Mvp.Sample.Conversations.Domain.Repositories;
using Shape.Mvp.Sample.Conversations.Views;

namespace Shape.Mvp.Sample.Conversations.Presenters
{
	public class CakeListPresenter : Presenter<ICakeListView>
	{
		private readonly IRepository<Cake> _cakeRepository;
		private readonly ICakeListView _view;

		public CakeListPresenter(
			IApplicationController applicationController, 
			ICakeListView view,
			IRepository<Cake> cakeRepository) : base(applicationController, view)
		{
			_view = view;
			_cakeRepository = cakeRepository;
		}

		public void Initialise()
		{
			foreach (var cake in _cakeRepository.GetAll())
			{
				_view.AddCake(cake.Name);
			}
		}

	}
}
